//
//  StackDemo.swift
//  firstFontAttrDemo
//
//  Created by liy on 2025/1/20.
//

import SwiftUI

struct StackDemo: View {
  var body: some View {
    VStack {
			HStack(alignment: .center) {
        Rectangle()
          .fill(.red)
          .frame(width: 80, height: 100)
        Rectangle()
          .fill(.green)
          .frame(width: 50, height: 130)
        Rectangle()
          .fill(.blue)
          .frame(width: 60, height: 100)
      }
      Spacer()
			
			//flex布局中space-between around可以依靠spacer()设置
      VStack(alignment: .leading) {
        Rectangle()
          .fill(.red)
          .frame(width: 200, height: 100)
        Rectangle()
          .fill(.green)
          .frame(width: 100, height: 130)
        Rectangle()
          .fill(.yellow)
          .frame(width: 200, height: 100)
      }

      Spacer()

      ZStack(alignment: .bottomTrailing) {
        Rectangle()
          .fill(.red)
          .frame(width: 200, height: 130)
        Rectangle()
          .fill(.green)
          .frame(width: 100, height: 230)
        Rectangle()
          .fill(.blue)
          .frame(width: 150, height: 100)
      }
    }
    .padding(50)
  }
}

#Preview {
  StackDemo()
}
